<template>
  <div class="event-area-content">
    <Navbar title="事件专区" :fooBack="true" @back="goback" />
    <van-tabs v-model:active="activeTab">
      <van-tab title="重大事件跟踪">
        <MajorEvent></MajorEvent>
      </van-tab>
      <van-tab title="民生事件统计">
        <LivelihoodEvent></LivelihoodEvent>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script lang="ts" setup>
import { config } from '@/config'
import { computed, ref, reactive, toRefs, watch, onActivated, getCurrentInstance } from 'vue'
import MajorEvent from './components/MajorEvent.vue'
import LivelihoodEvent from './components/LivelihoodEvent.vue'
import Navbar from '@/components/Navbar/index.vue'
import Cookies from 'js-cookie'
import { useRouter } from 'vue-router'
import { useEventStore } from '@/store'
import { storeToRefs } from 'pinia'

import EventServe from '@/api/event'

const eventStore = useEventStore()
const { time, hotWordType, rankType, wordType } = storeToRefs(eventStore)

const router = useRouter()

defineOptions({
  name: 'EventArea'
})

const activeTab = ref(0);

if(Cookies.get('event_type'))
  activeTab.value = Number(Cookies.get('event_type'))

Cookies.remove('event_type')

const goback = () => {
  //清空民生事件记录的tab
  time.value = '';
  hotWordType.value = '';
  rankType.value = 0;
  wordType.value = 0;
  router.back()
}
</script>

<script lang="ts">

</script>

<style lang="less" scoped>
  @import url('./index');
</style>
